/*
 * File:   Ground.cpp
 * Author: Elevator
 *
 * Created on 27 Март 2013 г., 1:07
 */

#include "Ground.h"

using namespace physics;

Ground::Ground( std::string id, float width ) :
	_id( id )
{
	_body = Physics::GetEngine( )->CreateBody( IBody::Static, Transform::ZERO, Transform::ZERO, 10.0f, 10.0f );
	IPolygonShape* poly = Physics::GetEngine( )->CreatePolygonShape( Transform::ZERO );
	Vector<Vec2>* vertices = new Vector<Vec2 > ( );

	vertices->Add( Vec2( -0.5f * width, 0.1f ) );
	vertices->Add( Vec2( -0.5f * width, -0.1f ) );
	vertices->Add( Vec2( 0.5f * width, -0.1f ) );
	vertices->Add( Vec2( 0.5f * width, 0.1f ) );

	poly->SetVertices( vertices );
	_body->CreateCollider( 1.0f, 1.0f, poly );
}

std::string Ground::GetId( ) const
{
	return _id;
}

Ground::~Ground( )
{
	Physics::GetEngine( )->DestroyBody( _body );
}

void Ground::Draw( ) const
{

}

void Ground::Update( float )
{

}

